package com.example.videoview;

import java.io.File;
    
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
    

public class MainActivity extends Activity {
	private VideoView vv_video;
    private MediaController mController;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        vv_video=(VideoView) findViewById(R.id.vv_video);
        // 实例化MediaController
        mController=new MediaController(this);
          // 设置播放视频源的路径
            vv_video.setVideoURI(Uri.parse("测试"));
        

            vv_video.setMediaController(mController);
            // 为MediaController指定控制的VideoView
            mController.setMediaPlayer(vv_video);
            // 增加监听上一个和下一个的切换事件，默认这两个按钮是不显示的
            mController.setPrevNextListeners(new OnClickListener() {
                    
                @Override
                public void onClick(View v) {                   
                    Toast.makeText(MainActivity.this, "下一个xxx",0).show();
                }
            }, new OnClickListener() {
                    
                @Override
                public void onClick(View v) {
                    Toast.makeText(MainActivity.this, "上一个xxxx",0).show();
                }
            });
        
    }
    
}
